package com.cwvs.controller.admin;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.cwvs.helper.UrlHelper;
import com.cwvs.services.AppFeedbackService;
import com.cwvs.utils.Pages;

/**
 * 广告Controller
 * 
 * @author Administrator
 * 
 */
@Controller
@RequestMapping("/admin")
public class AdminAppFeedbackController {
	@Resource
	private AppFeedbackService appFeedbackService;
	@Resource
	private UrlHelper urlHelper;
	@RequestMapping("/feedback_view")
	public ModelAndView view(HttpServletRequest request,
			HttpServletResponse response) {
		ModelAndView mv = new ModelAndView("app_feedback/app_feedback_list");
		return mv;
	}
	@RequestMapping("/feedback_list")
	public @ResponseBody
	Map<String, Object> list(HttpServletRequest request,
			HttpServletResponse response) {
		Pages page = new Pages();
		String limit = request.getParameter("limit");
		String start = request.getParameter("start");
		page.setPageSize(Integer.parseInt(limit));
		page.setCurrentPage(Integer.parseInt(start) / Integer.parseInt(limit)
				+ 1);
		HashMap<String, Object> paramsMap = new HashMap<String, Object>();
		paramsMap.put("USERNAME", request.getParameter("name"));
		paramsMap.put("CTIME", request.getParameter("ctime"));
		paramsMap.put("ETIME", request.getParameter("etime"));
		paramsMap.put("QUESTION", request.getParameter("question"));
		Pages rePage = appFeedbackService.list(paramsMap, page);
		Map<String, Object> ret = new HashMap<String, Object>();
		ret.put("rows", rePage.getPage());
		ret.put("totalCount", rePage.getTotalRecord());
		return ret;
	}
}
